﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Admin.master" AutoEventWireup="true" CodeFile="SanPham.aspx.cs" Inherits="Admin_ThucDon" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div class = "formBox">
    <h2>Sản phẩm</h2>
    <div class = "alignR">
        <asp:HyperLink ID="HyperLink5" runat="server" 
            NavigateUrl="~/Admin/SanPhamThem.aspx">Thêm mới</asp:HyperLink>
    </div>
    
<div style="float:left;width:24%;margin-top:10px;">
        <h3 style="border-bottom:1px solid green;">Loại sản phẩm</h3>

            <asp:DataList ID="DataListLoaiSanPham" runat="server" 
                CellPadding="4" DataSourceID="EntityDataSource1" 
                HorizontalAlign="Left" 
                DataKeyField="MaLoai" SelectedIndex="0" ForeColor="#333333" 
            Width="100%">
                <AlternatingItemStyle BackColor="White" />
                <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <ItemStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <ItemTemplate>
                    &nbsp;<asp:LinkButton ID="LinkButton1" runat="server" 
                        Text='<%# Eval("TenLoai") %>' CommandName="Select" 
                        CssClass="border-Bottom"></asp:LinkButton>
                    <br />
                </ItemTemplate>
                <SelectedItemStyle BackColor="#FFCC66" ForeColor="Navy" Font-Bold="True" />
            </asp:DataList>
</div>            
           
  <div style="float:right;width:75%;margin-top:10px;"">
  <h3 style="border-bottom:1px solid green;">Danh sách sản phẩm theo loại sản phẩm -
      <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
      </h3>

            <asp:GridView ID="gvSanPham" runat="server" AutoGenerateColumns="False" 
                   AllowPaging="True" AllowSorting="True" CellPadding="4" 
                   DataKeyNames="SanPhamID" DataSourceID="EntityDataSourceSanPham" 
          ForeColor="#333333" GridLines="None" Width="100%">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="SanPhamID" HeaderText="ID" ReadOnly="True" 
                        SortExpression="SanPhamID" />
                    <asp:BoundField DataField="TenSanPham" HeaderText="Tên sản phẩm" 
                        SortExpression="TenSanPham" />
                    <asp:BoundField DataField="DonGia" HeaderText="Đơn giá" 
                        SortExpression="DonGia" />
                    <asp:BoundField DataField="KhuyenMai" HeaderText="Khuyến mãi" 
                        SortExpression="KhuyenMai" />
                    <asp:CheckBoxField DataField="NgungBan" HeaderText="Ngưng bán" 
                        SortExpression="NgungBan" />
                    <asp:CommandField HeaderText="Chức năng" ShowDeleteButton="True" 
                        ShowEditButton="True" />
                    <asp:HyperLinkField DataNavigateUrlFields="SanPhamID" 
                        DataNavigateUrlFormatString="#" 
                        NavigateUrl="#" Target="_self" Text="Xem" />
                </Columns>
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                <SortedAscendingCellStyle BackColor="#FDF5AC" />
                <SortedAscendingHeaderStyle BackColor="#4D0000" />
                <SortedDescendingCellStyle BackColor="#FCF6C0" />
                <SortedDescendingHeaderStyle BackColor="#820000" />
            </asp:GridView>
</div>
            <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
                ConnectionString="name=EDiamondEntities1" 
                DefaultContainerName="EDiamondEntities1" EnableFlattening="False" 
                EntitySetName="LoaiSanPhams" Select="it.[TenLoai], it.[MaLoai]" 
                   OrderBy="it.[MaLoai]" EntityTypeFilter="">
            </asp:EntityDataSource>

               <asp:EntityDataSource ID="EntityDataSourceSanPham" runat="server" 
                   ConnectionString="name=EDiamondEntities1" 
                   DefaultContainerName="EDiamondEntities1" 
                   EnableFlattening="False" EntitySetName="SanPhams" 
                   OrderBy="it.[SanPhamID]" 
                   Where="it.MaLoai = @id" EnableDelete="True" 
        EnableUpdate="True">
                   <WhereParameters>
                       <asp:ControlParameter ControlID="DataListLoaiSanPham" Name="id" 
                           PropertyName="SelectedValue" Type="Int32" />
                   </WhereParameters>
               </asp:EntityDataSource>

       
            
       
    </div>
    


</asp:Content>

